import 'package:get/get.dart';
import 'package:fixnum/fixnum.dart' as $fixnum;

/// 真爱榜controller
class TrueLoveRankController extends GetxController {
  final $fixnum.Int64? channelId;

  TrueLoveRankController({this.channelId});

  // List<TrueLoveRankListItem>? data;

  String? errorMsg;

  @override
  void onInit() {
    super.onInit();
  }

  @override
  void onReady() {
    super.onReady();
    // loadData();
  }

  // Future loadData({LoadState state = LoadState.init}) async {
  //   if (state == LoadState.init) {
  //     reset();
  //     update();
  //   }
  //   var resp = await Api.getTrueLoveRankList(channelId: channelId);
  //   if (resp.isSuccess && resp.data != null) {
  //     data = resp.data!.items;
  //   } else {
  //     String msg = resp.errorMsg ?? T.current!.service_error_retry;
  //     if (state == LoadState.refresh) {
  //       showToast(msg);
  //     } else {
  //       errorMsg = msg;
  //     }
  //   }
  //   update();
  // }

  void reset() {
    // data = null;
    errorMsg = null;
  }

  static $fixnum.Int64 safeChannelId($fixnum.Int64? channelId) {
    return channelId ?? $fixnum.Int64(-0x1001);
  }
}
